<?php
if (strpos($_SERVER['PHP_SELF'],basename(__FILE__)) !== false) {
  print "Direct module access forbidden.".basename(__FILE__);
  exit;
}

	global $dbi,$lg;
	
	// Authority Check
	
	// Tool Bar
	$o_tool = new ToolBar('T1');
	$o_tool->Add(new BTool('bnew',"?module=hrmd&action=goals&sact=edit"));
	
	// Display Goals List
	$sql  = "SELECT g.idgoa,t.vtext AS goanm,g.keywd,g.gotyp ";
	$sql .= "FROM go00 AS g INNER JOIN dd01t AS t ";
	$sql .= "ON g.idgoa = t.posnr ";
	$sql .= "WHERE t.idelm = 'goanm' ";	
	$sql .=	"AND t.langu = '$lg->langu' ";
	$sql .=	"ORDER BY g.gotyp,t.vtext ";
	$t_data = $dbi->fetch_all($sql,'array');
	if(is_array($t_data))
	{
		foreach($t_data as $key => $s_data)
		{
			$t_data[$key]['goanm'] = '<a href="?module=hrmd&action=goals&sact=edit&idgoa='.$s_data['idgoa'].'">'.$s_data['goanm'].'</a>';
		}
	}
	// Grid
	$o_grid = new Grid('GGO');
	$o_grid->SetFieldcat(array('idgoa','gonam','keywd','gotyp'));
	$o_grid->SetDatas($t_data);
	// Layout
	
	// Rendering
	echo $o_tool->Display();
	echo "<br>";
	echo $o_grid->Display();
	
?>